package com.huike.controller.user;

import com.huike.common.result.Result;
import com.huike.dto.LoginDto;
import com.huike.service.UserService;
import com.huike.vo.LoginVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/users/employee")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 生成登录验证码
     */
    @GetMapping("/getCodeImage")
    public void getCodeImage(HttpServletResponse response) {

        userService.getCodeImage(response);

    }

    /**
     * 用户登录
     * @param loginDto
     * @return
     */
    @PostMapping("/login")
    public Result<LoginVo> userLogin(@RequestBody LoginDto loginDto){
        return userService.userLogin(loginDto);

    }
}
